
#include "Generate_C_std.h"

Pattern::Pattern () : use_scope (true) {}


Pattern::~Pattern() {}

string Pattern::generate (String* comment, Generate_C* gen)
{
  // clear the buffer
  buf.str ("");
  
  buf << *comment;
  
  // Unless its a class, method or string, it should be wrapped in a scope.
  if (this->use_scope)
    buf << "{\n";
  
  buf << increment_stat (demangle (this));

  
  this->generate_code (gen);
  
  if (this->use_scope)
    {
      buf
	<<		"phc_check_invariants (TSRMLS_C);\n"
	<< "}\n";
    }
  
  return buf.str();
}


